import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

// 重写路由添加方法
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error => error)
}
import ShowBlog from '../components/ShowBlog.vue'
import AddBlog from '../components/AddBlog.vue'
import  SingleBlog from '../components/SingleBlog.vue'
import  Edit from '../components/Edit.vue'
import Login from '../components/login.vue'


const router = new Router({
    mode:"history",
    routes:[
        {
         path: '/',
        component:ShowBlog
        },
        {
         path:'/add',
         component:AddBlog
        },
        {
         path:'/blog/:id',
         component:SingleBlog
        },
        {
         path:'/edit/:id',
         component: Edit
         },
        {
        path:'/login',
        component:Login
        }
        


    ]
})
export default router